package server.fsm;

import etc.SynchronizationParameters;

public class WaitingState extends GenericServerState {

	@Override
	public String login( String username, String password ) {
		if( username.equalsIgnoreCase(SynchronizationParameters.getLocalUsername())
				&& password.equalsIgnoreCase(SynchronizationParameters.getLocalPassword()) ) {
			getServerContext().setCurrentServerState( new AuthorizedState(), "Client is now authorized, waiting for commands.");
			return "<login result='ok' />";
		}else{
			return "<login result='fail'>You have provided invalid login credentials.</login>";
		}
	}
	
}
